<?php
require 'user.php';
require 'function.php';
if(file_exists($path=@_decode($_GET['path']))==false) {
header('Content-Type:text/html;charset=UTF-8');
echo <<<HTML
Error：404
HTML;
exit;
}
?>
<?php
header('Content-Type:text/html;charset=UTF-8');
echo <<<HTML
<html>
<head>
<title>文件管理－查看</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}
.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;
echo '<a href="index.php?path='._encode(dirname(_decode($_GET['path']))).'">'.dirname(_decode($_GET['path'])).'</a>/'.basename(_decode($_GET['path']));
if($_GET['read']==null) {
$read=@_view(_decode($_GET['path']),'1000');
$count=@count($read);
if($read!=false) {
if($_GET['page']==null) {
$page='0';
} elseif($_GET['page']=='0') {
$page='0';
} elseif($_GET['page']=='1') {
$page='0';
} elseif(preg_match('/^([0-9]+)$/',$_GET['page'])==false) {
$page='0';
} else {
$page=$_GET['page']-1;
}
echo <<<HTML
<div class="big_board"><div class="board_title">爱特文管－快捷按钮</div></div>
<form action="{$_SERVER['PHP_SELF']}" method="get"><a href="{$_SERVER['PHP_SELF']}?path={$_GET['path']}&read=read">全文查看</a>.<a href="viewcode.php?path={$_GET['path']}">高亮</a>.<a href="svnview.php?path={$_GET['path']}">SVN追踪</a>.<a href="openfile.php?path={$_GET['path']}">编辑模式</a>.
<input type="text" name="page" size="3"/>
<input type="hidden" name="path" value="{$_GET['path']}"/>
<input type="submit" value="跳转"/>
</form>
HTML;
echo <<<HTML
<div class="big_board"><div class="board_title">爱特文管－分页查看</div></div>
HTML;
$data=@str_replace(array('&','<','>'),array('&amp;','&lt;','&gt;'),$read[$page]);
echo nl2br($data);
echo '<div class="big_board"><div class="board_title">';
if(($page>'0')&&($page<=$count)) {
$prev=$page;
echo '<a href="view.php?path='.$_GET['path'].'&page='.$prev.'">上页</a>';
}
if(($page>'0')&&(($page+1)<$count)) {
echo '|';
}
if(($count>'1')&&(($page+1)<$count)) {
$next=$page+2;
echo '<a href="view.php?path='.$_GET['path'].'&page='.$next.'">下页</a>';
}
$_page=$page+1;
echo ' 第 '.$_page.'/'.$count.' 页';
echo '</div></div>';
} else {
echo <<<HTML
<div class="big_board"><div class="board_title">爱特文管－系统提示</div></div>
HTML;
echo 'Hello,文件内容为空!';
}
} else {
echo <<<HTML
<div class="big_board"><div class="board_title">爱特文管－快捷按钮</div></div>
<a href="{$_SERVER['PHP_SELF']}?path={$_GET['path']}&page=1">分页查看</a>.<a href="viewcode.php?path={$_GET['path']}">高亮</a>.<a href="svnview.php?path={$_GET['path']}">SVN追踪</a>.<a href="editor.php?path={$_GET['path']}">编辑模式</a>
HTML;
echo <<<HTML
<div class="big_board"><div class="board_title">爱特文管－全文查看</div></div>
HTML;
$iread=@file_get_contents(_decode($_GET['path']));
$iread=@str_replace(array('&','<','>'),array('&amp;','&lt;','&gt;'),$iread);
echo nl2br($iread);
}
echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
HTML;
?>